package cn.weisoft.webdemo.controller;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;

@RestController

@RequestMapping("/demo")
@RefreshScope
public class DemoController {

    @Value("${com.weisoft.dataKey01}")

    private String dataKey01;

    @GetMapping("/index")
    public String index(){
        return "index";
    }


    @GetMapping("/getDataKey01")
    public String getDataKey01(){
        return this.dataKey01;
    }


    @RequestMapping(value = "/echo/{string}", method = RequestMethod.GET)
    public String echo(@PathVariable String string) {
        System.out.println("Called at " + LocalDateTime.now().toString());

        return "Hello Nacos Discovery " + string;
    }

}
